<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://xmlns.jcp.org/jsf/passthrough">
    <ui:composition template="/template.xhtml">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <ui:define name="title">
            <h:outputLabel value="#{messages.Reexamin}"></h:outputLabel>
        </ui:define>
        <ui:define name="body">
            <h:outputScript library="javaScript" name="wait.js" target="head"/>

            <h:form id="myform" styleClass="jsfcrud_list_form"  prependId="false" rendered="#{reexaminationController.resourceType==0}">
                <h:panelGrid columns="3">
                    <h:commandLink value="#{messages.View} #{messages.ReexaminedWaited} #{messages.Knowledge}" action="#{reexaminationController.myRecord(0,0)}" class="mya"/>
                    <h:commandLink value="#{messages.View} #{messages.ReexaminedPassed} #{messages.Knowledge}" action="#{reexaminationController.myRecord(0,1)}" class="mya"/>
                    <h:commandLink value="#{messages.View} #{messages.ReexaminedFailed} #{messages.Knowledge}" action="#{reexaminationController.myRecord(0,2)}" class="mya"/>
                </h:panelGrid>
                <hr/>
                <h:panelGrid p:id="mysubjectList">
                    <h:outputLabel escape="false" value="#{messages.List}" rendered="#{knowledgeController.items.rowCount == 0}"/>
                </h:panelGrid>

                <h:panelGroup rendered="#{knowledgeController.items.rowCount > 0}" >
                    <h:outputLabel value="#{knowledgeController.pagination.pageFirstItem + 1}..#{knowledgeController.pagination.pageLastItem + 1}/#{knowledgeController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{knowledgeController.pageOperation.previous}" value="#{messages.Previous} #{knowledgeController.pagination.pageSize}" rendered="#{knowledgeController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{knowledgeController.pageOperation.next}" value="#{messages.Next} #{knowledgeController.pagination.pageSize}" rendered="#{knowledgeController.pagination.hasNextPage}"/>&nbsp;
                    <h:dataTable value="#{knowledgeController.items}" id="knowledgeTbl" var="item" border="0" cellpadding="2" cellspacing="0" 
                                 rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" 
                                 columnClasses="editRemoveview">
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{knowledgeController.prepareView}" value="#{messages.View}"/>
                            &nbsp;
                            <h:commandLink action="#{knowledgeController.prepareEdit}" value="#{messages.Edit}"
                                           rendered="#{reexaminationController.isEditable(item,null)}"/>
                            &nbsp;
                            <h:commandLink action="#{knowledgeController.destroy}"   onclick="if (!confirm('#{messages.Delete}?'))
                                        return false"  value="#{messages.Destroy}"
                                           rendered="#{reexaminationController.isDeletable(item, null)}"/>
                            &nbsp; <h:outputLabel value="#{reexaminationController.getStatusName(null, item)}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel value="#{messages.Name}"/>
                            </f:facet>
                            <h:outputLabel value="#{item.name}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel value="#{messages.Detail}"/>
                            </f:facet>
                            <h:outputText escape="false"  value="#{item.details}" />
                            <!--显示图像、音频、视频或PDF文档-->

                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel value="#{messages.Question}#{messages.Number}"/>
                            </f:facet>
                            <h:commandLink action ="#{questionController.prepareList(item.getQuestionSet())}" value="#{item.getQuestionSet().size()}" rendered="#{item.getQuestionSet().size()>0}"/>
                            <h:outputLabel value="0" rendered="#{item.getQuestionSet().size()==0}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel value="#{messages.Subject}"/>
                            </f:facet>
                            <h:outputLabel value="#{item.subjectId.name}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputLabel value="#{messages.Createdby} #{messages.Name1}"/>
                            </f:facet>
                            <h:outputLabel value="#{knowledgeController.showedName(item)}"/>
                        </h:column>
                    </h:dataTable>
                    <h:outputLabel value="#{knowledgeController.pagination.pageFirstItem + 1}..#{knowledgeController.pagination.pageLastItem + 1}/#{knowledgeController.pagination.itemsCount}"/>&nbsp;
                    <h:commandLink action="#{knowledgeController.pageOperation.previous}" value="#{messages.Previous} #{knowledgeController.pagination.pageSize}" rendered="#{knowledgeController.pagination.hasPreviousPage}"/>&nbsp;
                    <h:commandLink action="#{knowledgeController.pageOperation.next}" value="#{messages.Next} #{knowledgeController.pagination.pageSize}" rendered="#{knowledgeController.pagination.hasNextPage}"/>&nbsp;
                </h:panelGroup>
                <input type="hidden" value="#{praiseController.msg}" id="msg"/>
            </h:form>
            <h:form styleClass="jsfcrud_list_form" prependId="false" rendered="#{reexaminationController.resourceType==1}">
                <h2 id="workingIndicator" style="display: none">
                    <h:graphicImage library="images" name="pleaseWait.gif"/>
                </h2>
                <h:outputScript name="jquery.min.js" library="javaScript" target="head"/>
                <h:outputScript name="marked.min.js" library="javaScript" target="head"/>
                <h:panelGrid columns="3">
                    <h:commandLink value="#{messages.View} #{messages.ReexaminedWaited} #{messages.Question}" action="#{reexaminationController.myRecord(1,0)}" class="mya"/>
                    <h:commandLink value="#{messages.View} #{messages.ReexaminedPassed} #{messages.Question}" action="#{reexaminationController.myRecord(1,1)}" class="mya"/>
                    <h:commandLink value="#{messages.View} #{messages.ReexaminedFailed} #{messages.Question}" action="#{reexaminationController.myRecord(1,2)}" class="mya"/>
                </h:panelGrid>
                <hr/>
                <h:panelGrid columns="1">
                    <h:panelGrid>
                        <h:outputLabel escape="false" value="#{messages.Empty}" rendered="#{questionController.items.rowCount == 0}"/>
                        <h:panelGroup rendered="#{questionController.items.rowCount > 0}" >
                            <h:outputLabel value="#{questionController.pagination.pageFirstItem + 1}..#{questionController.pagination.pageLastItem + 1}/#{questionController.pagination.itemsCount}"/>&nbsp;
                            <h:commandLink action="#{questionController.pageOperation.previous}" value="#{messages.Previous} #{questionController.pagination.pageSize}" rendered="#{questionController.pagination.hasPreviousPage}"/>&nbsp;
                            <h:commandLink action="#{questionController.pageOperation.next}" value="#{messages.Next} #{questionController.pagination.pageSize}" rendered="#{questionController.pagination.hasNextPage}"/>&nbsp;
                            <h:dataTable value="#{questionController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" >
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="&nbsp;"/>
                                    </f:facet>
                                    <h:commandLink action="#{questionController.prepareView()}" value="#{messages.View}"/>
                                    &nbsp;
                                    <h:commandLink action="#{questionController.prepareEdit()}" value="#{messages.Edit}" rendered="#{reexaminationController.isEditable(null, item)}"/>
                                    &nbsp;
                                    <h:commandLink action="#{questionController.destroy()}" value="#{messages.Destroy}" rendered="#{reexaminationController.isDeletable(null, item)}"   onclick="if (!confirm('#{messages.Delete}?'))
                                                return false" />
                                    <h:outputLabel value="#{reexaminationController.getStatusName(item, null)}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="#{messages.QuestionTitle}"/>
                                    </f:facet>
                                    <h:outputLabel value="#{item.valueinfo}" escape="false" />
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="#{messages.Selection}" />
                                    </f:facet>
                                    <h:outputText escape="false"  value="#{item.getSecondContenItems()}" />
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="#{messages.Type}"/>
                                    </f:facet>
                                    <h:outputLabel value="#{questionControllerA.getTypeString(item.type)}"/>
                                </h:column>                                    
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="#{messages.Answer}"/>
                                    </f:facet>
                                    <h:outputLabel value="#{questionControllerA.getAnswer(item)}"  p:id="myeditor"/>
                                </h:column>                                    
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="#{messages.Score}"/>
                                    </f:facet>
                                    <h:outputLabel value="#{item.score}"/>
                                </h:column>   
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="#{messages.Analysis}"/>
                                    </f:facet>
                                    <h:outputText escape="false"  value="#{item.analysis}" />
                                </h:column>   
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="#{messages.Createdby} #{messages.Name1}"/>
                                    </f:facet>
                                    <h:outputLabel value="#{questionController.showedName(item)}"/>
                                </h:column>                                
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputLabel value="#{messages.Knowledge}"/>
                                    </f:facet>
                                    <h:commandLink action ="#{knowledgeController.prepareView(item.knowledgeId)}" value="#{item.knowledgeId.name}"/>
                                </h:column>
                            </h:dataTable>
                            <h:outputLabel value="#{questionController.pagination.pageFirstItem + 1}..#{questionController.pagination.pageLastItem + 1}/#{questionController.pagination.itemsCount}"/>&nbsp;
                            <h:commandLink action="#{questionController.pageOperation.previous}" value="#{messages.Previous} #{questionController.pagination.pageSize}" rendered="#{questionController.pagination.hasPreviousPage}"/>&nbsp;
                            <h:commandLink action="#{questionController.pageOperation.next}" value="#{messages.Next} #{questionController.pagination.pageSize}" rendered="#{questionController.pagination.hasNextPage}"/>&nbsp;
                        </h:panelGroup>
                    </h:panelGrid>
                </h:panelGrid>
                <hr/>
            </h:form>  
        </ui:define>
    </ui:composition>
</html>
